package com.mojo.web.kafka;

import com.mojo.web.constant.MyConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.context.annotation.Bean;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.function.Consumer;

/**
 * 消费者监听
 *
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2021, 广州九尾信息科技有限公司
 * @date 2021/11/12 18:05
 */

@Component
public class NyKafkaConsumerListener {
    private static final Logger logger = LoggerFactory.getLogger(NyKafkaConsumerListener.class);

    @KafkaListener(topics = MyConstants.TOPIC, groupId = "testGroup", id = "testGroup")
    public void getMessage(String message) {
        logger.info("消费消息message：{}", message);
    }
    //
    //@StreamListener("topic1")
    //public void getTopicMessage(String message) {
    //    logger.info("消费消息message：{}", message);
    //}

}
